package cn.doitedu.dfdemo

import cn.doitedu.util.SparkUtil

/**
 * @Date 22.4.10
 * @Created by HANGGE
 * @Description
 */
object C08_DF_Write {
  def main(args: Array[String]): Unit = {
    val session = SparkUtil
      .getSession
    val df = session.read.option("header" , true).option("inferSchema",true).csv("data/csv/Teacher2.csv")
     // 打印结构
    df.printSchema()

    // 将数据写出
    df.write.json("")
    df.write.parquet("")
    df.write.orc("")
    df.write.csv("")
    df.write.text("")
    df.createTempView("tb_x")

    session.sql(
      """
        |select  id , name  from tb_x
        |""".stripMargin).write.text("")

  }

}
